﻿<UserControl x:Class="CannedHeater.View.StatisticsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:View="clr-namespace:CannedHeater.View"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <!-- DataContext set from MainPage -->
    
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <!-- Binds to the datahistory of the datafetcher -->
        <View:StatusPanelView Grid.Row="0"
                              x:Name="StatusPanel"
                              DataContext="{Binding LatestData}"/>

        <StackPanel Grid.Row="1" Margin="0,15,0,0" Orientation="Vertical">
            
            <!-- Binds to the GraphViewModel initialized in the StatisticsViewModel (These will always be closely related anyway -->
            
            <!-- IMPROVEMENT: Refactor the data structure, and use ItemsControl to bind to a list of HistoryTypes (Indoor, Outdoor...), to automatically display graphs
                 Disadvantage: All data will be shown as individual graphs, not all temperatures in one graph. -->
            <View:GraphView x:Name="Graphs"
                            DataContext="{Binding GVM}"/>
        </StackPanel>

    </Grid>
</UserControl>
